<?php
// +----------------------------------------------------------------------
// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2018 http://www.thinkcmf.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: kane <chengjin005@163.com> 小夏 < 449134904@qq.com>
// +----------------------------------------------------------------------
namespace app\wsapi\controller;

use cmf\controller\HomeBaseController;
use app\admin\model\CaseModel;
use think\Db;

/**
 * Class 
 * @package app\admin\controller
 */
class UserController extends HomeBaseController
{

	/**
	 * 登陆接口
	 */
	public function loginPost()
	{
		$data = $this->request->param();
		//用户手机号
		$customer_mobile = isset($data['customer_mobile'])?$data['customer_mobile']:ajaxReturn(['status'=>2,'msg'=>'手机号不能为空']);
		//用户密码
		$customer_password = isset($data['customer_password'])?$data['customer_password']:ajaxReturn(['status'=>2,'msg'=>'密码错误']);
		$result = Db::name('customer')->where(['customer_mobile'=>$customer_mobile])->find();
		if(!$result)
		{
			ajaxReturn(['status'=>2,'msg'=>'手机号不存在']);
		}
		if(md5($customer_password) != $result['customer_password'])
		{
			ajaxReturn(['status'=>2,'msg'=>'密码错误']);
		}

		
								
		ajaxReturn(['status'=>1,'msg'=>'登陆成功','data'=>['id'=>$result['id']]]);
	}


	

	
}